<?php
namespace core\lib;

class conf {
    static public $arr = [];
    static public function get( $name ) {

        /**
        * 1.找到配置文件
        * 2.配置变量
        */
        $name = \strtoupper( $name );

        return self::$arr[$name];
    }
    static public function load() {
        $filearr = scandir( CONF );
        unset( $filearr[0] );
        unset( $filearr[1] );

        // if(self::$arr!=[]){           
        //     // return self::$arr;            
        // }else{           
            foreach ( $filearr as $file ) {

                if ( \file_exists( CONF.'/'.$file ) ) {
    
                    $prarr = include( CONF.'/'.$file );    
                    self::$arr = array_merge( $prarr, self::$arr );                  
    
                }
            }
        // }
        // return self::$arr;
   
    }

}
